package com.dragon.repository.domain.vo;

import com.dragon.common.model.Update;
import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.ExamineFile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@ApiModel(value = "")
public class ExamineFileVO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id")
    private Integer id;

    @ApiModelProperty(value = "审核子表id")
    private Integer examineUserId;

    @ApiModelProperty(value = "文件名称")
    private String fileName;

    @ApiModelProperty(value = "附件地址")
    private String url;

    @ApiModelProperty(value = "文件类型：0,图片，1文件")
    private Integer fileType;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;


    @NotNull(groups = Update.class,message = "主键不能为空")
    public static ExamineFile convert(ExamineFileVO vo) {
        ExamineFile entity = new ExamineFile();
        BeanUtils.copyProperties(vo,entity);
        return entity;
    }
    public static List<ExamineFile> convertList(List<ExamineFileVO> list) {
        List<ExamineFile> resultList = new ArrayList<>();
        for (ExamineFileVO vo : list) {
            resultList.add(convert(vo));
        }
        return resultList;
    }
}
